<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ddwrt2="urn:frontpage:internal" >
	<xsl:param name="ResultsBy" />
	<xsl:param name="ViewByUrl" />
	<xsl:param name="ViewByValue" />
	<xsl:param name="IsNoKeyword" />
	<xsl:param name="IsFixedQuery" />
	<xsl:param name="MoreResultsText" />
	<xsl:param name="MoreResultsLink" />
	<xsl:param name="CollapsingStatusLink" />
	<xsl:param name="CollapseDuplicatesText" />
	<xsl:param name="MeHeaderValue" />
	<xsl:param name="CollHeaderValue" />
	<xsl:param name="CollOfCollHeaderValue" />
	<xsl:param name="EveryoneHeaderValue" />
	<xsl:param name="AddToMyColleaguesText" />
	<xsl:param name="SrchRSSText" />
	<xsl:param name="SrchRSSLink" />
	<xsl:param name="ShowMessage" />
	<xsl:param name="ShowActionLinks" />

<!-- When there is keywory to issue the search -->
	<xsl:template name="dvt_1.noKeyword">
	<span class="ms-sbplain">
		<xsl:choose>
			<xsl:when test="$IsFixedQuery">
  				Please set the &apos;Fixed Query&apos; property for the webpart.
			</xsl:when>
			<xsl:otherwise>
  				Enter one or more words to search for in the search box.
			</xsl:otherwise>
		</xsl:choose>
	</span>       
</xsl:template>


<!-- When empty result set is returned from search -->
	<xsl:template name="dvt_1.empty">
		<xsl:if test="$ShowActionLinks">
		<div class="srch-sort">
			<xsl:if test="string-length($SrchRSSLink) &gt; 0">     
				<a type="application/rss+xml" href ="{$SrchRSSLink}" title="{$SrchRSSText}" id="SRCHRSSL">
   					<img border="0" src="/_layouts/images/rss.gif" alt=""/>
   					<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
   					<xsl:value-of select="$SrchRSSText"/>
				</a>
			</xsl:if>
		</div>
	</xsl:if>
	<br/> 
	<br/>
	<span class="ms-sbplain" id="CSR_NO_RESULTS">
		No results matching your search were found.
		<ol>
			<li>Check your spelling. Are the words in your query spelled correctly?</li>
			<li>Try using synonyms. Maybe what you&apos;re looking for uses slightly different words.</li>
			<li>Make your search more general. Try more general terms in place of specific ones.</li>
			<li>Try your search in a different scope. Different scopes can have different results.</li>
		</ol>
	</span>
</xsl:template>


<!-- Main body template. Sets the Results view (Relevance or date) options -->
	<xsl:template name="dvt_1.body">
		<xsl:variable name="Rows" select="All_Results/Result" />
	
	
	<table cellspacing="0" cellpadding="0" class="cbq-layout-main">
		<tr>
			<td colspan="4">
				<table class="am-grid-header" cellspacing="0" cellpadding="0">
	        		<tr> 
	        			<td style="width:5px"><img src="/Style Library/PodcastingKit/Images/mid_round_tab_lh.gif" alt="" /></td>
	        			<td class="am-grid-headerbar" valign="middle">
		        				<table width="100%">
		        					<tr>
		        						<td class="am-grid-headerbaritem am-grid-sort" width="35px" onmouseenter="openSortDropdown(this);" onmouseleave="closeSortDropdown(this);">
                          <!--Sort 
		        							<img src="/Style Library/PodcastingKit/Images/down_arrow.gif" alt="Sort" />
		        							<div class="am-grid-sortdropdown">
		        								<ul>
		        									<li><a href="javascript:sortGrid('podcastername');" style="color:white;">Podcaster Name</a></li>
		        									<li><a href="javascript:sortGrid('rating');" style="color:white;">Rating</a></li>
		        									<li><a href="javascript:sortGrid('downloads');" style="color:white;">Downloads</a></li>
		        									<li><a href="javascript:sortGrid('contribution');" style="color:white;">Contribution</a></li>		
		        									<li><a href="javascript:sortGrid('favorites');" style="color:white;">Favorites</a></li>  
		        									<li><a href="javascript:sortGrid('rrpoints');" style="color:white;">RR Points</a></li>
		           								</ul>
		        							</div>-->
		        						</td>
		        						<td class="am-grid-headerbaritem" width="170px">
		        							
		        						</td>
		        						<td class="am-grid-headerbaritem">
		        							
		        						</td>
		        						<td align="right" class="am-grid-headerbaritem">
		        							
		        						</td>
		        					</tr>
		        				</table>		        			
		        			</td>
	        			<td style="width:5px"><img src="/Style Library/PodcastingKit/Images/mid_round_tab_rh.gif" alt="" /></td>
	        		</tr>
    			</table>
			</td>
		</tr>
		<tr>
			<xsl:for-each select="$Rows">
				<xsl:if test="position() mod 4 = 1">
					<xsl:value-of select="string('&lt;/tr&gt; &lt;tr&gt;')" disable-output-escaping="yes" />
				</xsl:if>
				<xsl:call-template name="Item" />
			</xsl:for-each>	
      
			<xsl:if test="count($Rows) mod 4 = 1"><td class="am-blankitem" /><td class="am-blankitem" /><td class="am-blankitem" /></xsl:if>
			<xsl:if test="count($Rows) mod 4 = 2">
				<td class="am-blankitem"></td><td class="am-blankitem"></td></xsl:if>
			<xsl:if test="count($Rows) mod 4 = 3">
				<td class="am-blankitem"></td>
			</xsl:if>
		</tr>
    <tr>
        <td colspan="4">
          <table class="am-grid-header" cellspacing="0" cellpadding="0">
             <tr>
               <td style="width:5px">
                 <img src="/Style Library/PodcastingKit/Images/mid_round_tab_lh.gif" alt="" />
               </td>
               <td class="am-grid-headerbar" style="width:100%; text-align:right;" />
               <td style="width:5px">
                 <img src="/Style Library/PodcastingKit/Images/mid_round_tab_rh.gif" alt="" />
               </td>
             </tr>
          </table>
        </td>
    </tr>
  </table>	
	  
		<xsl:call-template name="DisplayMoreResultsAnchor" />
  
</xsl:template>

	<xsl:template name="Item">
  		<!--<xsl:variable name="id" select="userprofile_guid"/>-->
  		<xsl:variable name="id" select="accountname"/>
  		<xsl:variable name="email" select="workemail"/>
  		<xsl:variable name="sip" select="sipaddress"/>
  		<xsl:variable name="prefix">IMNRC(&apos;</xsl:variable>
  		<xsl:variable name="suffix">&apos;)</xsl:variable>
  		<xsl:variable name="position" select="position() - 1" />
  		<xsl:variable name="last" select="last() - 1" />
  		<xsl:variable name="url">
			<xsl:value-of select="concat(string('/Pages/PodcasterDetail.aspx?username='), $id)" />
		</xsl:variable>
  
  		<xsl:variable name="name" select="preferredname" />
  		<xsl:variable name="title" select="jobtitle" />
  		<xsl:variable name="picture">
  			<xsl:choose>
  				<xsl:when test="string-length(pictureurl) &gt; 0">
  			<xsl:value-of select="pictureurl" />
  		</xsl:when>
  				<xsl:otherwise>
  			<xsl:value-of select="string('/Style Library/PodcastingKit/Images/NoAuthorImage.jpg')" disable-output-escaping="yes" />
  		</xsl:otherwise>
  			</xsl:choose>
  </xsl:variable>

	<td class="gal_item_wraper" valign="top" style="margin:0px;">
		<div class="am-griditem">
			<center>
			<div>
				<a href="{$url}">
					<img src="{$picture}" width="120px" height="90px" alt="{$name}" />
				</a>
			</div>
			<div class="am-griditem-username">
				<table>
					<tr>
						<td valign="middle">
							<b><a class="am-desclink" href="{$url}">
								<xsl:value-of select="$name" />
							</a></b>		
						</td>
					</tr>
				</table>
			</div>
			</center>
			<div style="height:24px;">
				<xsl:choose>
					<xsl:when test="string-length($title) &gt; 13">
						<xsl:value-of select="substring($title,1,13)" />
						<xsl:value-of select="'...'" />
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$title" />
					</xsl:otherwise>
				</xsl:choose>
				
			</div>
			<table width="100%" style="margin-top:6px;">
				<tr>
					<td>Downloads</td>
					<td align="right">0</td>
				</tr>
				<tr>
					<td>Contribution</td>
					<td align="right">0</td>
				</tr>
				<tr>
					<td>R&amp;R Points</td>
					<td align="right">0</td>
				</tr>
			</table>
		</div>
	</td>

</xsl:template>

<!-- This template is called for each result -->
	<xsl:template match="All_Results/Result">
		<xsl:variable name="id" select="id"/>
		<xsl:variable name="url" select="url"/>
		<xsl:variable name="email" select="workemail"/>
		<xsl:variable name="sip" select="sipaddress"/>
		<xsl:variable name="prefix">IMNRC(&apos;</xsl:variable>
		<xsl:variable name="suffix">&apos;)</xsl:variable>
		<xsl:variable name="position" select="position() - 1" />
		<xsl:variable name="last" select="last() - 1" />

		<xsl:variable name="name" select="preferredname" />
		<xsl:variable name="title" select="jobtitle" />
		<xsl:variable name="picture">
			<xsl:choose>
				<xsl:when test="string-length(pictureurl) &gt; 0">
				<xsl:value-of select="pictureurl" />
			</xsl:when>
				<xsl:otherwise>
				<xsl:value-of select="string('/Style Library/Images/NoAuthorImage.jpg')" disable-output-escaping="yes" />
			</xsl:otherwise>
			</xsl:choose>
  	</xsl:variable>
  
  	<table>
  		<tr> 
		  	<td class="gal_item_wraper" valign="top" style="margin:0px;">
				<div class="am-griditem">
					<center>
					<div>
						<a href="{$url}">
							<img src="{$picture}" width="120px" height="90px" alt="{$name}" />
						</a>
					</div>
					<div class="am-griditem-username">
						<table>
							<tr>
								<td valign="middle">
									<b><a class="am-desclink" href="{$url}">
										<xsl:value-of select="$name" />
									</a></b>		
								</td>
							</tr>
						</table>
					</div>
					</center>
					<div style="height:24px;">
						<xsl:value-of select="$title" />
					</div>
					<div>
						<img src="/Style Library/Images/star_gray.gif" alt="Rating" />
						<img src="/Style Library/Images/star_gray.gif" alt="Rating" />
						<img src="/Style Library/Images/star_gray.gif" alt="Rating" />
						<img src="/Style Library/Images/star_gray.gif" alt="Rating" />
						<img src="/Style Library/Images/star_gray.gif" alt="Rating" />
					</div>
					<div>
						# Rating(s)
					</div>
					<table width="100%" style="margin-top:6px;">
						<tr>
							<td>Downloads</td>
							<td align="right">0</td>
						</tr>
						<tr>
							<td>Contribution</td>
							<td align="right">0</td>
						</tr>
						<tr>
							<td>Favorites</td>
							<td align="right">0</td>
						</tr>
						<tr>
							<td>R&amp;R Points</td>
							<td align="right">0</td>
						</tr>
					</table>
				</div>
			</td>	  
  		</tr>
  	</table>
 </xsl:template>

	

<!-- The "view more results" for fixed query -->
	<xsl:template name="DisplayMoreResultsAnchor">
		<xsl:if test="$MoreResultsLink">
		<a href="{$MoreResultsLink}">
			<xsl:value-of select="$MoreResultsText"/> 
		</a>
	</xsl:if>
</xsl:template>

	<xsl:template name="DisplayAddToMyColleaguesLink">
		<xsl:param name="url"/>
	<a href="{$url}">
  		<xsl:value-of select="$AddToMyColleaguesText"/>
	</a>
   	<br/>
</xsl:template>

<!-- document collapsing link setup -->
	<xsl:template name="DisplayCollapsingStatusLink">
    	<xsl:param name="status"/>
    	<xsl:param name="url"/>
    	<xsl:if test="$CollapsingStatusLink">
      		<xsl:choose>
          		<xsl:when test="$status=1">
              <br/>
              		<xsl:variable name="CollapsingStatusHref" select="concat(substring-before($CollapsingStatusLink, '$$COLLAPSE_PARAM$$'), 'duplicates:&quot;', $url, '&quot;', substring-after($CollapsingStatusLink, '$$COLLAPSE_PARAM$$'))"/>
              [<a href="{$CollapsingStatusHref}" title="{$CollapseDuplicatesText}">
              <xsl:value-of select="$CollapseDuplicatesText"/>
              </a>]
          </xsl:when>
      		</xsl:choose>
    </xsl:if>
</xsl:template>

<!-- XSL transformation starts here -->
	<xsl:template match="/" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
		<xsl:choose>
			<xsl:when test="$IsNoKeyword = 'True'" >
				<xsl:call-template name="dvt_1.noKeyword" />
		</xsl:when>
			<xsl:when test="$ShowMessage = 'True'">
 				<xsl:call-template name="dvt_1.empty" />
		</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="dvt_1.body"/>      
		</xsl:otherwise>
		</xsl:choose>
</xsl:template>

<!-- End of Stylesheet -->
</xsl:stylesheet>